<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>IE 缓存问题</title>
    <style>
      #result {
        border: 5px solid pink;
        width: 200px;
        height: 100px;
      }
    </style>
  </head>
  <body>
    <button>点击发送</button>
    <div id="result"></div>
    <script>
      const btn = document.querySelector("button");
      const result = document.getElementById("result");
      btn.addEventListener("click", function () {
        // 发送请求
        const xhr = new XMLHttpRequest();
        xhr.responseType = "json";
        xhr.open("GET", "http://www.xin.com:8000/json-server?t="+Date.now());
        xhr.send();
        xhr.onreadystatechange = function () {
          if (xhr.readyState === 4) {
            if ((xhr.status >= 200) & (xhr.status < 300)) {
              console.log(xhr.response);
              result.innerText = xhr.response.name;
            }
          }
        };
      });
    </script>
  </body>
</html>
